package cn.org.eshow.webapp.action.response;


import cn.org.eshow.model.ProductCategory;

import java.util.List;

public class ZtreeResponse {

    private Integer id;
    private Integer pId;
    private String name;
    private Boolean nocheck;
    private Boolean open;
    private Boolean down;
    private Boolean isParent = Boolean.FALSE;
    private List<ZtreeResponse> children;


    public ZtreeResponse() {
    }

    public ZtreeResponse(Integer id, Integer pid, String name, Boolean down) {
        this.id = id;
        this.pId = pid;
        this.name = name;
        this.nocheck = true;
        this.open = true;
        this.down = down;
    }

    public ZtreeResponse(ProductCategory productCategory, Integer pId, Boolean open, Boolean nocheck, Boolean down) {
        this.id = productCategory.getId();
        this.pId = pId;
        this.name = productCategory.getName();
        this.nocheck = nocheck;
        this.open = open;
        this.down = down;
    }

    public boolean equals(Object obj) {
        if (obj instanceof ZtreeResponse) {
            ZtreeResponse u = (ZtreeResponse) obj;
            return this.id.equals(u.id)
                    && this.name.equals(name);
        }
        return super.equals(obj);
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getpId() {
        return pId;
    }

    public void setpId(Integer pId) {
        this.pId = pId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getNocheck() {
        return nocheck;
    }

    public void setNocheck(Boolean nocheck) {
        this.nocheck = nocheck;
    }

    public Boolean getOpen() {
        return open;
    }

    public void setOpen(Boolean open) {
        this.open = open;
    }

    public Boolean getDown() {
        return down;
    }

    public void setDown(Boolean down) {
        this.down = down;
    }

    public Boolean getIsParent() {
        return isParent;
    }

    public void setIsParent(Boolean isParent) {
        this.isParent = isParent;
    }

    public List<ZtreeResponse> getChildren() {
        return children;
    }

    public void setChildren(List<ZtreeResponse> children) {
        this.children = children;
    }

    public Boolean getParent() {
        return isParent;
    }

    public void setParent(Boolean parent) {
        isParent = parent;
    }
}
